package com.mixbox.db;

import android.annotation.TargetApi;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Build;

public class BaseDBHelper extends SQLiteOpenHelper {

	private static BaseDBHelper sDBHelper;

	private static final int VERSION = 0;

	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	public static synchronized BaseDBHelper getInstance(Context context, String name) {
		if (sDBHelper == null) {
			if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
				sDBHelper = new BaseDBHelper(context, name, null, VERSION);
			} else {
				sDBHelper = new BaseDBHelper(context, name, null, VERSION, new DatabaseErrorHandler() {

					@Override
					public void onCorruption(SQLiteDatabase dbObj) {

					}
				});
			}
		}
		return sDBHelper;
	}

	private BaseDBHelper(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	private BaseDBHelper(Context context, String name, CursorFactory factory, int version,
			DatabaseErrorHandler errorHandler) {
		super(context, name, factory, version, errorHandler);
		// TODO 尚未实现
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO 该方法尚未实现

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO 该方法尚未实现

	}

}
